package edu.ntu.im.p2ptrade.msg;

import edu.ntu.im.p2ptrade.P2PTrade;
import net.jxta.endpoint.Message;
import net.jxta.endpoint.StringMessageElement;

abstract public class ControlMsg implements PMessage {
	 String transactionId;
	
	public Message getMessageToTransfer() {
		Message msg  = new Message();
		msg.addMessageElement(P2PTrade.getInstance().getAppName(), new StringMessageElement(PEER, P2PTrade.getInstance().getPeerName(), null));
		msg.addMessageElement(P2PTrade.getInstance().getAppName(), new StringMessageElement(TRANSACTIONID, this.transactionId, null));
		this.attachType(msg);
		return msg;
	
	}
	abstract public void attachType(Message msg);

}
